//
//  JYBaseRegModel.m
//  MYCCBRegisterSubAccount
//
//  Created by 应明顺 on 2018/7/5.
//  Copyright © 2018年 JackYing. All rights reserved.
//

#import "JYBaseCellModel.h"

@implementation JYBaseCellModel

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.need = NO;
    }
    return self;
}

- (void)dealloc {
#ifdef DEBUG
    NSLog(@"[%@ --> %p, %@]", NSStringFromClass([self class]), self, @"dealloc");
#endif
}

+ (instancetype)modelWithItemKey:(NSString *)itemKey title:(NSString *)title {
    
    JYBaseCellModel *model = [self modelWithItemKey:itemKey title:title content:nil];
    return model;
}

+ (instancetype)modelWithItemKey:(NSString *)itemKey title:(NSString *)title content:(NSString *)content {
    JYBaseCellModel *model = [[self alloc] init];
    model.itemKey = itemKey;
    model.title = title;
    model.content = content;
    return model;
}

- (NSString *)description {
    NSString *description = [NSString stringWithFormat:@"<%p>, title:%@ itemKey:%@ contentID:%@ content:%@", self, _title, _itemKey, _contentID, _content];
    
    return description;
}

- (NSUInteger)hash {
    NSString *stringToHash = [NSString stringWithFormat:@"%@:%@",_itemKey,_title];
    return [stringToHash hash];
}

- (BOOL)isEqual:(JYBaseCellModel *)object {
    if ([self.itemKey isEqualToString:object.itemKey]) {
        return YES;
    }
    return [super isEqual:object];
}

- (CGFloat)estimatedHeight {
    return _estimatedHeight < 1 ? 44 : _estimatedHeight;;
}


- (BOOL)verifyContent {
    if (self.isNeed
        && (!self.content && !self.contentID)) {
        return NO;
    }
    return YES;
}

@end
